<template>
	<div class="body">
		<!-- 粉红色圆球 -->
		<div class="bubble"></div>
		<div class="bubble"></div>
		<div class="bubble"></div>
		<div class="bubble"></div>
		<div class="bubble"></div>

		<!-- 中间的主要内容区域 -->
		<div class="main">
			<h1>404</h1>
			<h2>Error</h2>
			<p>您在红尘中迷路了！</p>
			<button @click="goHome">Go Home</button>
			<button @click="goBack">Back</button>
		</div>
	</div>
</template>

<script setup>
// 外部文件引入区

// 外部方法引入区
import { useRouter } from "vue-router";

// 方法注册
const router = useRouter();

/**
 * goBack 返回上一个页面，使用路由的back方法返回到上一个页面
 */
function goBack() {
	router.back();
}

/**
 * goHome 跳转到首页，使用路由的push方法去到首页，也就是跳转路径到"/"
 */
function goHome() {
	router.push("/");
}
</script>

<style lang="less" scoped>
.body {
	width: 100vw;
	height: 100vh;
	background: linear-gradient(#203075, #233581);
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	color: #fff;
	text-shadow: 0 30px 10px rgba(0, 0, 0, 0.15);
	.main {
		text-align: center;
		z-index: 5;
		p {
			font-size: 18px;
			margin-top: 0;
		}
		h1 {
			font-size: 145px;
			margin: 0;
		}
		button {
			background: linear-gradient(#ec5dc1, #d61a6f);
			padding: 5px 12px;
			margin: 0 5px;
			border: none;
			border-radius: 20px;
			box-shadow: 0 30px 15px rgba(0, 0, 0, 0.15);
			color: #fff;
			text-transform: uppercase;
		}
	}

	.bubble {
		background: linear-gradient(#ec5dc1, #d61a6f);
		border-radius: 50%;
		box-shadow: 0 30px 15px rgba(0, 0, 0, 0.15);
		position: absolute;
	}
	.bubble:nth-child(1) {
		top: 15vh;
		left: 15vw;
		height: 22vmin;
		width: 22vmin;
	}
	.bubble:nth-child(1):before {
		width: 13vmin;
		height: 13vmin;
		bottom: -25vh;
		right: -10vmin;
	}
	.bubble:nth-child(2) {
		top: 20vh;
		left: 38vw;
		height: 10vmin;
		width: 10vmin;
	}
	.bubble:nth-child(2):before {
		width: 5vmin;
		height: 5vmin;
		bottom: -10vh;
		left: -8vmin;
	}
	.bubble:nth-child(3) {
		top: 12vh;
		right: 30vw;
		height: 13vmin;
		width: 13vmin;
	}
	.bubble:nth-child(3):before {
		width: 3vmin;
		height: 3vmin;
		bottom: -15vh;
		left: -18vmin;
		z-index: 6;
	}
	.bubble:nth-child(4) {
		top: 25vh;
		right: 18vw;
		height: 18vmin;
		width: 18vmin;
	}
	.bubble:nth-child(4):before {
		width: 7vmin;
		height: 7vmin;
		bottom: -10vmin;
		left: -15vmin;
	}
	.bubble:nth-child(5) {
		top: 60vh;
		right: 18vw;
		height: 28vmin;
		width: 28vmin;
	}
	.bubble:nth-child(5):before {
		width: 10vmin;
		height: 10vmin;
		bottom: 5vmin;
		left: -25vmin;
	}
}
</style>
